package com.quyunshuo.module.home.dialog

import android.app.Dialog
import android.os.Bundle
import android.widget.TextView
import androidx.appcompat.app.AlertDialog
import androidx.fragment.app.DialogFragment
import com.quyunshuo.module.home.R

class MyDialogFragment:DialogFragment() {

    override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
        return activity?.let {
            val builder = AlertDialog.Builder(requireContext())
            val inflater = requireActivity().layoutInflater
            val view = inflater.inflate(R.layout.dialog_message, null)

            val editText = view.findViewById<TextView>(R.id.tv_dialog_message_title)
            val btnPositive = view.findViewById<TextView>(R.id.tv_dialog_message_cancel)
            val btnNegative = view.findViewById<TextView>(R.id.tv_dialog_message_confirm)

            builder.setView(view)

            btnPositive.setOnClickListener {
                dismiss()
            }

            btnNegative.setOnClickListener {
                dismiss()
            }

            builder.create()
        } ?: throw IllegalStateException("Activity cannot be null")
    }
}